#ifndef __SLOTHTTPD_REQUEST_HEADERS_HPP__
#define __SLOTHTTPD_REQUEST_HEADERS_HPP__

#include <slothttpd/types.hpp>

#include <ostream>

#include <boost/intrusive/slist.hpp>

namespace slothttpd {

class request_header :
        public boost::intrusive::slist_base_hook<>
{
public:
    request_header() = default;
    
    inline request_header(char_range_t n, char_range_t v) :
        name(n),
        value(v)
    {
    }
    
    char_range_t name;
    char_range_t value;
};

typedef boost::intrusive::slist<request_header, boost::intrusive::cache_last<true> > request_header_list;

inline std::ostream &operator<<(std::ostream &os, const request_header_list &list)
{
    for (const request_header &h : list) {
        os << "  " << h.name << ": " << h.value << '\n';
    }
    
    return os;
}

}

#endif
